import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_base/config/app_color.dart';

class WidgetTopTitle extends StatelessWidget {
  const WidgetTopTitle({
    super.key,
    this.leftView,
    this.rightView,
    this.middleView,
    required this.title
  });
  final Widget? leftView;
  final Widget? rightView;
  final Widget? middleView;
  final String title;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 44.w,
      width: double.infinity,
      padding: EdgeInsets.symmetric(horizontal: 16.w),
      child: Stack(
        children: [
          Positioned.fill(
              child: Center(
                child: middleView == null ?
                Text(
                  title,
                  style: TextStyle(
                      color: AppColor.color262829,
                      fontSize: 18.sp,
                      fontWeight: FontWeight.w600
                  ),
                ): middleView!,
              )
          ),
          Positioned.fill(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  if (leftView != null) leftView!,
                  if (rightView != null) rightView!,
                ],
          ))
        ],
      ),
    );
  }

}